#!/usr/env/bin python
# -*- coding: utf-8 -*-

# @Time    : 2020-11-09 9:44 上午
# @Author  : yangdy
# @File    : 2020-11.08.122. 买卖股票的最佳时机 II
# @Software: PyCharmCE
from tools.my_methods import *


class Solution:
    def maxProfit(self, prices):
        """
        :type prices: List[int]
        :rtype: int
        """
        ans = 0
        for i in range(1, len(prices)):
            if prices[i] > prices[i-1]:
                ans += prices[i]-prices[i-1]
        return ans
